#questions 1- how many unit sold by retailers and in which gender?
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
ggplot(Adidas_dataset,aes(Retailer,Units_Sold,col=sex))+
geom_boxplot()+
labs(x="retailers",y="units sold",title="units sold by retailers")+
theme_bw()

#question 2-Average of total sales?
average_sales <- mean(Adidas_dataset$Total_Sales)
print(average_sales)
## [1] 93273.44
#question 3-Average price per unit sold?
average_price_per_unit <- mean(Adidas_dataset$Price_per_Unit)
print(average_price_per_unit)
## [1] 45.21663
#question 4-in which method how much sales is done and how much?
method_with_max_sales <- names(which.max(table(Adidas_dataset$Sales_Method)))
max_sales_count <- max(table(Adidas_dataset$Sales_Method))
print(paste("Method with the maximum number of sales:", method_with_max_sales))
## [1] "Method with the maximum number of sales: Online"
print(paste("Number of sales for this method:", max_sales_count))
## [1] "Number of sales for this method: 4889"
#question 5-from which product the hieghest operating profit is done and how much?
product_with_max_profit <- Adidas_dataset$Product_re[which.max(Adidas_dataset$Operating_Profit)]
max_profit <- max(Adidas_dataset$Operating_Profit)
print(paste("Product with the highest profit:", product_with_max_profit))
## [1] "Product with the highest profit: Street"
print(paste("Highest profit:", max_profit))
## [1] "Highest profit: 390000"
#question 6-which region have how much sales and by which method?
library(ggplot2)
new<-ggplot(Adidas_dataset, aes(x = Region, y = Total_Sales,col=Sales_Method)) +
geom_bar(stat = "identity") +
labs(title = "Region-wise Sales", x = "Region", y = "Sales")+
theme_bw()
plotly::ggplotly(new)
#question 7- what is the distribution of sales in men's and women's section?
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
sales_distri <- Adidas_dataset %>%
group_by(sex) %>%
summarise(sex = sum(Total_Sales))
print(sales_distri)
## # A tibble: 2 × 1
## sex
## <dbl>
## 1 486228556
## 2 413673569
#question 8-product wise sales distribution?
product_saldis <- Adidas_dataset %>%
group_by(Product_re) %>%
summarise(Product_re = sum(Total_Sales))
print(product_saldis)
## # A tibble: 3 × 1
## Product_re
## <dbl>
## 1 302767492
## 2 260305576
## 3 336829057
#question 9-
library(plotly)
## Warning: package 'plotly' was built under R version 4.3.3
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
manthan<-ggplot(Adidas_dataset, aes(Units_Sold,Operating_Profit)) +
geom_point(color="orangered") +
geom_abline(intercept = 0,slope = 1)+geom_smooth(method="lm")+
labs(x = "Units Sold",y="Operating_Profit") +
ggtitle("Scatter Plot of Price per Unit vs. Units Sold")+
theme_bw()
plotly::ggplotly(manthan)
## `geom_smooth()` using formula = 'y ~ x'
#Quess 11)median of the dataset
median(Adidas_dataset$Price_per_Unit)
## [1] 45
median(Adidas_dataset$Units_Sold)
## [1] 176
median(Adidas_dataset$Total_Sales)
## [1] 9576
#Quess 12)coorelation matrix
library(corrplot)
## Warning: package 'corrplot' was built under R version 4.3.3
## corrplot 0.92 loaded
c1<-Adidas_dataset[, c("Price_per_Unit","Operating_Margin","Operating_Profit","Total_Sales","Units_Sold")]
correlation_matrix <- cor(c1)
corrplot(correlation_matrix, method = "shade", addCoef.col = "white")

#Ques 13 BOXPLOT
library(ggplot2)
albania_data <- Adidas_dataset[Adidas_dataset$Region != "", ]
ggplot(albania_data, aes(x = Region, y = Units_Sold, fill = Units_Sold, color="orangered")) +
geom_boxplot() +
labs(title = "Distribution of Units Sold by Region",
x = "Region",
y = "Units Sold")
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
## the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
## variable into a factor?

#Ques 14)what are the quantile values of operating profit:
r<-quantile(Adidas_dataset$Operating_Profit)
boxplot(r)

#Ques 16)what is the density bw sales method and city
library(plotly)
library(ggplot2)
p1<-ggplot(Adidas_dataset, aes(x=Adidas_dataset$Sales_Method, fill=City)) +
geom_density(alpha=0.4)
plotly::ggplotly(p1)